home *** CD-ROM | disk | FTP | other *** search
- /*
- * File: Request.h
- *
- * Contains: xxx put contents here xxx
- *
- * Written by: Rick Violet
- *
- * Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
- *
- * Change History (most recent first):
- *
- * 09/11/94 SBR Added ExtractValueFromNthParam for Boolean
- * <2> 4/29/93 RV Add GetError access method
- * <5+> 11/19/92 RV
- * 11/18/92 RV xxx put comment here xxx
- *
- * To Do:
- */
-
- #ifndef __Request__
- #define __Request__
-
- class Request;
-
- /*SBR Hacked this in 05/24/94*/
- #ifndef __PASCALSTRING__
- #include "PascalString.h"
- #endif
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __STRING__
- #include <String.h>
- #endif
-
- #ifndef __Object__
- #include "Object.h"
- #endif
-
- #ifndef __ScriptValue__
- #include "ScriptValue.h"
- #endif
-
- /*SBR Hacked this in 10/16/94 */
- #ifndef __Service__
- #include "Service.h"
- #endif
-
- #ifndef __THREADS__
- #include "Threads.h"
- #endif
-
- const unsigned long kDefaultTimeOutSeconds = 60;
-
- //—————————————————————————————————————————————————————————————————————————————————————
- // Request class - represents the service request from the V.U. script
- //—————————————————————————————————————————————————————————————————————————————————————
- class Request : public Object
- {
- protected: //———————————————————————
- char* fWhichService;
- VUList* fParamList;
- ScriptValue* fReturnValue;
- OSErr fErrorCode;
- char* fErrorMessage;
- unsigned long fSendResetTicks;
- Boolean fCanceled;
- long fRequestIdentifier;
-
- /*SBR Hacked this in 10/16/94 */
- ThreadID fThreadID;
- ThreadOptions fThreadOptions;
- Service* fService;
-
- public: //———————————————————————
- Request();
- virtual ~Request();
-
- OSErr Initialize();
-
- Boolean HasBeenCanceled();
- /*SBR Hacked this into Request.cp 10/16/94 */
- void CancelThisRequest();
- Boolean IsACancelRequest();
- virtual Boolean IsCancelRequestForThisRequest( Request* pCancelReq );
- Boolean IsThreaded();
-
- virtual void ResetTimeOutCounter( unsigned long pNewTimeOutInterval = kDefaultTimeOutSeconds );
-
- virtual void SetErrorCode( OSErr tErr );
- virtual void SetErrorMessage( char* tErrText );
-
- char* GetWhichService(){ return fWhichService; };
-
- OSErr GetNthParam( short pIndex, ScriptValuePtr& pValue, ValueKind& pVKind );
- OSErr ExtractValueFromNthParam( short pIndex, short* pShortPtr );
- OSErr ExtractValueFromNthParam( short pIndex, long* pLongPtr );
- OSErr ExtractValueFromNthParam( short pIndex, char* pCharPtr );
-
- OSErr ExtractValueFromNthParam( short pIndex, CStr255* pCStr255Ptr );
- OSErr ExtractValueFromNthParam( short pIndex, CStr63* pCStr63Ptr );
- OSErr ExtractValueFromNthParam( short pIndex, CStr32* pCStr32Ptr );
- OSErr ExtractValueFromNthParam( short pIndex, CStr31* pCStr31Ptr );
-
- OSErr ExtractValueFromNthParam( short pIndex, ScriptValue** pScriptValuePtrPtr );
- OSErr ExtractValueFromNthParam( short pIndex, char** pCharPtrPtr );
- OSErr ExtractValueFromNthParam( short pIndex, Boolean* pBooleanPtr );
-
- short GetParamCount();
- virtual long GetIdentifierOfRequesttoCancel(){ return -1; };
-
- /*SBR Hacked this in 10/16/94 */
- ThreadID GetThreadID( ){ return fThreadID; };
- void SetThreadID( ThreadID pThreadID ){ fThreadID = pThreadID; };
- Service* GetService( ){ return fService; };
- void SetService( Service* pService ){ fService = pService; };
-
- void SetReturnValue( Boolean pFlag );
- void SetReturnValue( short pNumber );
- void SetReturnValue( long pLongNumber );
- void SetReturnValue( char* pString );
- void SetReturnValue( ScriptValue* pScriptValue );
-
- virtual void SendResult(){};
- OSErr GetError(){ return fErrorCode; };
- long GetRequestIdentifier(){ return fRequestIdentifier; };
-
- protected: //———————————————————————
-
- void SetWhichService( char* pServiceText );
- void SetParameterList( VUList* pParamList ){ fParamList = pParamList; };
- void SetRequestIdentifier( long pID ){ fRequestIdentifier = pID; };
-
- };
-
- #endif
-